package com.duobab.springbootwebsocketdemo.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sendMessage")
public class WebsocketServerController {
    @Autowired
    private SimpMessagingTemplate messagingTemplate;

    @RequestMapping(method = RequestMethod.GET)
    public void sendMessage() {
        messagingTemplate.convertAndSend("channel", "hello");
    }
}
